from Game.Win import My_Window
from .dianji import Game_Dj
import json


def json_data(gamexy_json_path):
    with open(gamexy_json_path, 'r', encoding ='utf-8' ) as file:
        # 加载JSON数据
        data = json.load(file)
        return data
    

class Game(My_Window,Game_Dj):

    def __init__(self, window_title,config_json_path = None,ui_instance=None):
        """
        辅助的主类,window_title="窗口的标题"
        config_json_path="配置文件路径"
        """
        self.ui = ui_instance
        
        config_data = json_data(config_json_path)
        super().__init__(window_title)
        # My_Window.__init__(window_title) #初始化window类
        Game_Dj.__init__(self,window_title,config_data['game_xy_path']) #初始化Game_Dj类，加载坐标
    def get_user_data(self):
        """
        获取玩家基本信息
        """
        self.dianji("玩家主页")
    def start_dayu(self):
        """
        开始打鱼模式
        """
        print("开始打鱼")
        self.dianji("进攻")
        self.dianji("开始搜索")
    

